package com.moyq5.permit.center.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.moyq5.mvc.framework.general.Body;
import com.moyq5.mvc.framework.general.PageData;
import com.moyq5.permit.center.bean.search.Merch4Search;
import com.moyq5.permit.center.feign.client.MerchFeign;
import com.moyq5.permit.center.web.jackson.filter.MerchFilter;


/**
 * 商户
 * @author Moyq5
 * @date 2019年7月31日
 */
@RestController
@RequestMapping("/merch")
public class MerchController extends BaseController {
	
	private static Logger log = LoggerFactory.getLogger(MerchController.class);
	
	@Autowired
	private MerchFeign merchFeign;
	
	/**
	 * @author Moyq5
	 * @date 2019年7月31日
	 * @param merch4s
	 * @param pd
	 * @return
	 * @throws JsonProcessingException
	 */
	@GetMapping(value="/page", produces={MediaType.APPLICATION_JSON_UTF8_VALUE})
	@ResponseBody
	public String page(Merch4Search merch4s, PageData pd) throws JsonProcessingException {
		log.debug("查询商户信息>>>page(Merch4Search, PageData)");
		return toJson(merchFeign.page(new Body<Merch4Search, PageData>(merch4s, pd)), MerchFilter.get());
	}
	
}
